<template>
  <div class="app-container">
    <el-row :gutter="10" class="mb8">
      <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true" class="el-form-search">
        <el-form-item label="名称" prop="name" class="el-form-search-item">
          <el-input v-model="queryParams.name" placeholder="请输入网站名称" clearable size="mini" style="width: 140px"
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="状态" prop="status" class="el-form-search-item">
          <el-select v-model="queryParams.status" placeholder="网站状态" clearable size="mini" style="width: 140px">
            <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
              :value="dict.value" />
          </el-select>
        </el-form-item>
        <el-form-item class="el-form-search-item">
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
    </el-row>

    <div v-loading="loading">
      <el-row :gutter="24">
        <el-col :sm="6" :sx="24" class="site-card-col" v-for="site in siteList" :key="site.id">
            <div class="is-hover-shadow site-card el-tooltip__trigger">
              <div class="el-card__body" style="border:1px solid #20B2AA;border-radius: 10px;margin-bottom: 10px;">
                <section class="el-container">
                  <aside class="el-aside site-card-aside">
                    <div class="el-image site-card-logo">
                      <img src="https://gesdh.cn/geshanzsq-file/profile/site/system/65da39e3-2d3b-4e7c-8590-73ac52b2fbeb.png" loading="lazy" class="el-image__inner">
                    </div>
                  </aside>
                  <main class="el-main site-card-main">
                    <a class="site-title"><strong>{{site.name}}</strong></a>
                    <div class="site-description">{{site.description}}</div>
                  </main>
                </section>
                <div><label style="font-size:12px;color: #979898;">所属分类：</label><span style="font-size:15px;">网盘搜索</span></div>
              </div>
            </div>
        </el-col>
      </el-row>
    </div>

    <el-empty v-if="total == 0" description="暂无数据" />
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" :page-sizes="[8, 12, 16, 20]" />
  </div>
</template>
<script>
  import {
    page,
  } from "@/api/nav/site";
  export default {
    name: "Site1",
    dicts: ["sys_normal_disable"],
    components: {},
    data() {
      return {
        tableHeight: document.documentElement.clientHeight - 180,
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 角色表格数据
        siteList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 是否显示弹出层（数据权限）
        openDataScope: false,
        menuExpand: false,
        menuNodeAll: false,
        deptExpand: true,
        deptNodeAll: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 8,
          name: undefined,
          status: undefined,
        },
        // 表单参数
        form: {},
        defaultProps: {
          children: "children",
          label: "label",
        },
        // 表单校验
        rules: {
          name: [{
            required: true,
            message: "名称不能为空",
            trigger: "blur"
          }, ],
          sort: [{
            required: true,
            message: "顺序不能为空",
            trigger: "blur"
          }, ],
        },
      };
    },
    created() {
      this.getList();
    },
    methods: {
      /** 查询角色列表 */
      getList() {
        this.loading = true;
        page(this.queryParams).then(
          (response) => {
            this.siteList = response.rows;
            this.total = response.total;
            this.loading = false;
          }
        );
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
    },
  };
</script>
<style lang="scss" scoped>
  .site-card {
    cursor: pointer;
  }
  .site-card-aside {
    background-color: transparent;
    width: 40px;
    overflow: hidden;
    padding: 0px;
    margin: 0px;
    text-align: center;
  }
  .site-card-logo {
    border-radius: 50%;
    width: 40px;
    height: 40px;
  }
  .site-card-main {
    padding: 0;
    margin-left: 5px;
  }
  .site-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
    font-size: 15px;
    margin-left: 10%;
    color: #373e4a;
  }
  .site-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-top: 5px;
    font-size: 14px;
    height: 39px;
    margin-left: 10%;
    color: #979898;
  }
</style>
